<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
        <head>
                <title>TestWidget 1.3</title>
                <script type="text/javascript">
                        var mainDiv;
                        var widgetID = "12345678";
                                        
                        function init() {
                                mainDiv = document.getElementById( "main" );
                        
                                if ( window.widget ) {
                                        widget.setCloseBoxOffset( 304, 16 );
                                        window.resizeTo( 640, 480 );
                                        //widgetID = widget.identifier;
                                }
                        }
                                        
                        function getLocalMailIDList() {
                                var storedLocalMailIDList = new Array();
                                var xmlHttp = new XMLHttpRequest();
                                xmlHttp.open("GET", "MessageUidsAlreadyDownloaded2", false);                                
                                xmlHttp.send(null);
                                
                                if (xmlHttp.readyState == 4) {
                                        var items = xmlHttp.responseXML;
                                        var counter = 0;
                                        
                                        for ( var i = 0; i < items.childNodes.length; i++ ) {
                                                counter++;
                                                
                                                if ( items.childNodes[i].nodeName == "plist" ) {
                                                        counter++;
                                                        //alert( items.childNodes[i].nodeName );
                                                        
                                                        for ( var j = 0; j < items.childNodes[i].childNodes.length; j++) {
                                                                counter++;
                                                                
                                                                if ( items.childNodes[i].childNodes[j].nodeName == "dict" ) {
                                                                        counter++;
                                                                        //alert( items.childNodes[i].childNodes[j].nodeName );
                                                                        
                                                                        for ( var k = 0; k < items.childNodes[i].childNodes[j].childNodes.length; k++) {
                                                                                counter++;
                                                                                
                                                                                if ( items.childNodes[i].childNodes[j].childNodes[k].nodeName == "key" ) {
                                                                                        counter++;
                                                                                        //alert( items.childNodes[i].childNodes[j].childNodes[k].nodeName );
                                                                                        //alert( items.childNodes[i].childNodes[j].childNodes[k].firstChild.nodeValue );
                                                                                        storedLocalMailIDList.push( items.childNodes[i].childNodes[j].childNodes[k].firstChild.nodeValue );
                                                                                }
                                                                        }
                                                                }
                                                        }
                                                }
                                        }
                                        
                                        /*
                                        for ( var i = 0; i < storedLocalMailIDList.length; i++ ) {
                                                counter++;
                                                mainDiv.innerText = storedLocalMailIDList[i];
                                        }
                                        */
                                        //alert(storedLocalMailIDList.length);
                                        
                                        
                                        //storedLocalMailIDList.sort();
                                        
                                        alert(counter);
                                }
                        }
                        
                        function getLocalMailIDList2() {
                                var storedLocalMailIDList = new Array();
                                var xmlHttp = new XMLHttpRequest();
                                xmlHttp.open("GET", "MessageUidsAlreadyDownloaded2", false);                                
                                xmlHttp.send(null);
                                
                                
                                if (xmlHttp.readyState == 4) {
                                        var items = xmlHttp.responseXML; //.getElementsByTagName("key");
                                        
                                        /*
                                        //alert(items.length);
                                        
                                        for ( var i = 0; i < items.length; i+= 2 ) {
                                                //alert( items[i].firstChild.nodeValue );
                                                //storedLocalMailIDList.push( items[i].firstChild.nodeValue );
                                        }
                                        
                                        //for ( var i = 0; i < storedLocalMailIDList.length; i++ ) {
                                        //        mainDiv.innerText = storedLocalMailIDList[i];
                                        //}
                                        
                                        //alert(storedLocalMailIDList.length);
                                        
                                        //storedLocalMailIDList.sort();
                                        */
                                }
                        }
                        
                        function clear() {
                                mainDiv.innerText = "C:\\>";
                        }
                        
                        function fillMyRam() {
                                getLocalMailIDList2();
                                setTimeout( "fillMyRam();", 500 );
                        }
                </script>
        </head>
        
        <body onLoad="init();">
             <div><a href="javascript:fillMyRam();">fillMyRam</a></div>
        </body>
</html>
